<template>
    <section class="product-manage-page">
      <div class="product-manage-mobile-page">11112</div>
      <div class="product-manage-pc-page">
        <section class="page-com" id="page" ref="page">
          <!-- 头部导航栏 -->
          <HeaderCom />
          <div class="banner">
            <img
              class="banner-bg"
              src="@/assets/images/productManage/banner.png"
              alt=""
              srcset=""
            />
            <p class="banner-text">创意探索 勇敢突破</p>
          </div>
          <!-- 项目结果公示 -->
          <div class="result-list">
            <div class="center">
                <div class="search">
                    <img
                        src="@/assets/images/search-icon.png"
                        alt=""
                        class="search-icon"
                    />
                    <el-input
                        placeholder="主体"
                        v-model="qureyParams.title"
                        style="width: 150px; margin-right: 10px"
                        clearable
                    >
                    </el-input>
                    <el-button size="mini" type="primary" @click="init">搜索</el-button>
                </div>
              <div class="title">项目结果公示</div>
              <div class="result-show-list" v-if="resultList.length">
                <div
                  class="result-item"
                  v-for="(item, index) in resultList"
                  :key="index"
                  @click="$router.push({name: 'productResultDetail', query: {id: item.id}})"
                >
                  <span class="result-title">{{ item.title }}</span>
                  <span class="result-date">{{ item.releaseTime || "--" }}</span>
                </div>
              </div>
              <div class="empty-product" v-else>
                <img
                  class="tips-img"
                  src="@/assets/images/productManage/empry.png"
                  alt=""
                />
                <p class="tips-text">暂无项目结果，敬请期待</p>
              </div>
              <div style="display: flex;flex-flow: row nowrap;justify-content: center;">
                <el-pagination
                class="bottom-page"
                background
                layout="prev, pager, next"
                :total="total"
                :page-size="pageSize"
                :page-sizes="[6, 12, 24, 36, 48]"
                @size-change="pagesizeHandle"
                @current-change="currentChange"
                :current-page="pageNo"
                >
                </el-pagination>
              </div>
            </div>
          </div>
          <div class="mainFooter" id="pageFooter">
            <FooterMenu />
          </div>
        </section>
      </div>
    </section>
  </template>
  
  <script>
  import Vue from "vue";
  import FooterMenu from "@/components/footerMenu/index.vue";
  import HeaderCom from "@/components/header";
  import vueMiniPlayer from "vue-mini-player";
  import "vue-mini-player/lib/vue-mini-player.css";
  import Pagination from "@/views/components/pagination";
  import PcProductItem from "./components/pcProductItem.vue";
  import Swiper from "swiper";
  import "swiper/css/swiper.min.css";
  import {
    getPraxisProjectTypeList,
    getPraxisProjectPage,
    getPraxisProjectItem,
    getProjectResultPage,
    getProjectResultById,
    createProductEntry,
  } from "../../request/api";
  Vue.use(vueMiniPlayer);
  export default {
    // 组件名称
    name: "productManage",
    // 组件参数 接收来自父组件的数据
    props: {},
    // 局部注册的组件
    components: { HeaderCom, FooterMenu, Pagination, PcProductItem },
    // 组件状态值
    data() {
      return {
        total: 0,
        pageNo: 1,
        pageSize: 10,
        resultList: [], // 项目结果列表
        qureyParams: {
            title: "",
        },
      };
    },
    created() {
      this.init();
    },
    // 组件方法
    methods: {
        currentChange(e) {
        this.pageNo = e;
        this.init();
        },
      pagesizeHandle(val) {
        this.pageSize = Number(val);
        this.init();
      },
      getResultList() {
        getProjectResultPage({
          pageSize: 10,
          pageNo: 1,
        }).then((res) => {
          console.log("项目结果展示", res);
          this.resultList = res.data.list;
          getProjectResultById({ id: res.data.list[0].id }).then((res) => {
            console.log("项目结果详情展示", res);
          });
        });
      },
      init() {
        this.getResultList();
      },
    },
  };
  </script>
  <style lang="less" scoped>
  .product-manage-page {
    position: relative;
    height: 100%;
    width: 100;
  }
  .product-manage-pc-page {
    .page-com {
      position: relative;
      width: 100%;
      height: 100%;
      overflow-y: auto;
      background: rgb(237, 242, 249);
      padding-top: 80px;
      .banner {
        position: relative;
        width: 100%;
        height: 220px;
        .banner-bg {
          position: relative;
          width: 100%;
          height: 220px;
          object-fit: cover;
        }
        .banner-text {
          position: absolute;
          top: 50%;
          left: 0;
          width: 100%;
          text-align: center;
          transform: translate3d(0, -50%, 0);
          font-size: 38px;
          font-family: "PingFangSC-Light, PingFang SC";
          font-weight: 300;
          color: #ffffff;
          line-height: 53px;
        }
      }
      .search {
        display: flex;
        flex-flow: row wrap;
        align-items: center;
        margin-bottom: 20px;
        padding-left: 30px;
        position: relative;
        .search-icon {
            width: 18px;
            height: 20px;
            position: absolute;
            left: 0;
            top: 10px;
        }

        .search-select {
            width: 160px;
            margin-right: 13px;
        }
      }
      .result-list {
        position: relative;
        width: 100%;
        background-color: #edf2f9;
        .center {
          width: 100%;
          max-width: 1200px;
          margin: 0 auto;
          background-color: #fff;
          padding: 30px 30px 40px;
          .title {
            position: relative;
            padding-left: 22px;
            height: 36px;
            font-size: 25px;
            font-family: PingFangSC-Semibold, PingFang SC;
            font-weight: 600;
            color: #37383d;
            line-height: 36px;
            margin-bottom: 30px;
            &:after {
              content: "";
              display: block;
              width: 7px;
              height: 25px;
              background-color: #3d6cb0;
              position: absolute;
              left: 0;
              top: 50%;
              transform: translate3d(0, -50%, 0);
            }
          }
          .result-item {
            position: relative;
            width: 100%;
            height: 68px;
            background-color: #fff;
            padding-left: 35px;
            padding-right: 15px;
            display: flex;
            flex-flow: row nowrap;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            .result-title {
              font-size: 20px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #37383d;
              line-height: 28px;
            }
            .result-date {
              font-size: 20px;
              font-family: PingFangSC-Regular, PingFang SC;
              font-weight: 400;
              color: #9597a0;
              line-height: 28px;
            }
            &:hover {
              background-color: #f9f9f9;
            }
            &:after {
              content: "";
              display: block;
              width: 8px;
              height: 8px;
              background-color: #3d6cb0;
              position: absolute;
              border-radius: 50%;
              left: 15px;
              top: 50%;
              transform: translate3d(0, -50%, 0);
            }
          }
        }
      }
    }
    .show-more-btn {
      width: 209px;
      height: 49px;
      line-height: 49px;
      background: #e1effe;
      border-radius: 16px;
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #3d6cb0;
      text-align: center;
      margin: 0 auto;
      cursor: pointer;
    }
    .empty-product {
      width: 100%;
      height: 100vh;
      max-height: 800px;
      display: flex;
      flex-flow: column nowrap;
      justify-content: center;
      align-items: center;
      .tips-img {
        width: 240px;
        margin-bottom: 25px;
      }
      .tips-text {
        text-align: center;
        font-size: 20px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 28px;
      }
    }
  }
  /deep/ .el-breadcrumb__inner {
  font-size: 18px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #37383d;
  line-height: 28px;
  cursor: pointer;
}
/deep/ .el-select-dropdown__item {
  font-size: 10px !important;
}
#app .el-pagination.is-background .el-pager li:not(.disabled).active {
  width: 32px !important;
  height: 32px !important;
}

.el-button--primary {
  width: 64px;
  height: 40px;
  padding: 0;
  background: #4677b9;
  border-radius: 5px;
  font-size: 15px;
  font-family: PingFangSC-Medium, PingFang SC;
  border: none;
  font-weight: 500;
}
.el-button--danger {
  background: #4677b9;
  border: none;
}
  @media (min-width: 769px) {
    .product-manage-mobile-page {
      display: none;
    }
    .product-manage-pc-page {
      display: block;
    }
  }
  @media (max-width: 768px) {
    .product-manage-mobile-page {
      display: block;
    }
    .product-manage-pc-page {
      display: none;
    }
  }
  
  </style>
  